package cmd

import (
	"errors"
	"gitee.com/MrDaiM/generate-project/handler"
	"github.com/spf13/cobra"
)

var create = &cobra.Command{
	Use:   "create",
	Short: "自动生成service项目目录",
	Long:  `该命令能够自动生成项目目录，方便快速开发`,
	Args: func(cmd *cobra.Command, args []string) error {
		if len(args) < 1 {
			return errors.New("请输入项目名称 eg:create github.com/leon/service")
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		handler.NewServiceProject(cmd, args)
	},
}

func init() {
	rootCmd.AddCommand(create)
}
